package com.zh.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zh.service.UserService;
import com.zh.user.entity.SysUser;
import com.zh.user.mapper.SysUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description:
 * @ClassName UserServiceImpl
 * @date: 2021.02.24 16:55
 * @Author: zhanghang
 */
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private SysUserMapper sysUserMapper;

    @Override
    public SysUser selectUserByUsername(String username) {
        SysUser sysUser = sysUserMapper.selectOne(new QueryWrapper<SysUser>().lambda().eq(SysUser::getUsername, username));
        return sysUser;
    }

    @Override
    public List<String> selectRoleCodeByUsername(String username) {
        return sysUserMapper.selectRoleCodeByUsername(username);
    }

    @Override
    public List<String> selectPermissionCodeByUsername(String username) {
        return sysUserMapper.selectPermissionCodeByUsername(username);
    }
}
